#pragma once
#include <iostream>
#include <string>
#include "SDLSprite.h"
#include "SDLResources.h"
#include "SDL_image.h"
#include <SDL_ttf.h>

class SDLTexte : public SDLSprite
{
public:
	SDLTexte();
	SDLTexte(std::string message, std::string fontFile, int x, int y, SDL_Color* color, int fontSize);

	SDLTexte(std::string* linkMessage, std::string fontFile, int x, int y, SDL_Color* color, int fontSize);
	SDLTexte(int* linkVariable, std::string fontFile, int x, int y, SDL_Color* color, int fontSize);
	SDLTexte(std::string beginText, int* linkVariable, std::string endText, std::string fontFile, int x, int y, SDL_Color* color, int fontSize);
	virtual ~SDLTexte();

	void LinkVariable(int* linkVariable);

	void SetCanSelectTexte(bool canSelect){canSelectTexte = canSelect;}
	void SetIsSelected(bool isSelect){isSelected = isSelect;}

	bool GetCanSelectTexte(){return canSelectTexte;}
	bool GetIsSelected(){return isSelected;}

	virtual void Update();
	

private:
	SDL_Texture* RenderText(std::string message, std::string fontFile, SDL_Color* color, int fontSize);
	SDL_Texture* RenderVariableMessageText(std::string* linkMessage, std::string fontFile, SDL_Color* color, int fontSize);
	SDL_Texture* RenderVariableText(int* linkVariable, std::string fontFile, SDL_Color* color, int fontSize);
	SDL_Texture* RenderVariableTextAndTexte(std::string beginText, int* linkVariable, std::string endText, std::string fontFile, SDL_Color* color, int fontSize);
	
	bool canSelectTexte;
	bool isSelected;

	bool isVariableTexte;
	bool isVariableMessageTexte;

	int* addressVariable;
	int temp;

	std::string* adressMessage;
	std::string tempMessage;

	int fontSize;
	std::string fontFile;
	SDL_Color theColor;

	std::string beginText;
	std::string endText;
};

